function refreshCaptcha() {
    // 这里需要替换为实际的验证码刷新逻辑，比如调用后端API
    document.getElementById('captcha-image').src = 'captcha.png?' + Math.random();
}

document.getElementById('login-form').addEventListener('submit', function(event) {
    event.preventDefault(); // 阻止表单默认提交行为
    const loginType = document.querySelector('input[name="login-type"]:checked').id;
    if (loginType === 'captcha-login') {
        const captchaInput = document.getElementById('captcha-input');
        // 添加验证码验证逻辑
        console.log('Captcha:', captchaInput.value);
    } else if (loginType === 'password-login') {
        const usernameInput = document.getElementById('username-input');
        const passwordInput = document.getElementById('password-input');
        // 添加账号密码验证逻辑
        console.log('Username:', usernameInput.value, 'Password:', passwordInput.value);
    }
});
document.getElementById('close-button').addEventListener('click', function() {
    document.querySelector('.login-container').style.display = 'none';
    enablePageInteractions();
});


// 显示登录窗口的逻辑
document.getElementById('open-button').addEventListener('click', function() {
    document.querySelector('.login-container').style.display = 'block';
    disablePageInteractions();
});


function disablePageInteractions() {
    document.body.classList.add('disable-interactions');
}

function enablePageInteractions() {
    document.body.classList.remove('disable-interactions');
}

// 当页面加载时，如果登录框已经显示，则立即禁用交互
if (document.querySelector('.login-container').style.display === 'block') {
    disablePageInteractions();
}